package com.geovis.emergency.spd.controller.mobile;

import com.geovis.common.auth.util.AuthUtil;
import com.geovis.common.core.api.Result;
import com.geovis.common.core.controller.BaseController;
import com.geovis.emergency.spd.biz.pc.service.IPcRollCallPersonService;
import com.geovis.emergency.spd.entity.mobile.pojo.dto.RollCallDTO;
import com.geovis.emergency.spd.util.MsgUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：linwl
 * @date ：Created in 2022/6/20 17:45
 * @description：移动端-应急预案指挥模块-点名相关接口
 * @version: v1
 */
@RestController
@RequestMapping("/mobile/pcRollCallPerson")
@RequiredArgsConstructor
@Api(value = "移动端-应急预案指挥模块-点名相关接口", tags = "移动端-应急预案指挥模块-点名相关接口")
@Slf4j
public class PcRollCallPersonMobileController extends BaseController<IPcRollCallPersonService> {

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "点名报告", notes = "点名报告")
    @GetMapping("checkIn/{pcRollCallId}")
    public Result<Void> checkIn(@PathVariable String pcRollCallId){
        String userId = AuthUtil.getCurrentUserId();
        baseService.updateSign(pcRollCallId, userId);
        //消息通知PC端
        MsgUtil.sendRollCallFeedback(pcRollCallId, userId);
        return Result.ok();
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "获取还未点名的列表",notes = "传演练id")
    @GetMapping("notCheckList/{pcDrillId}")
    public Result<RollCallDTO> notCheckList(@PathVariable String pcDrillId){
        return Result.ok(baseService.notCheckList(pcDrillId));
    }
}
